<!DOCTYPE html>
<html lang=zh-CN>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta property="og:description" content="">
    <meta property="og:type" content="website">
    <meta name="description" content="">
    <meta name="keyword"  content="">
    <link rel="shortcut icon" href="/admirefish/img/favicon.ico">

    <title>
        
        Swift5.9 - undefined
        
    </title>

    <!-- Custom CSS -->
    
<link rel="stylesheet" href="/admirefish/css/aircloud.css">

    
<link rel="stylesheet" href="/admirefish/css/gitment.css">

    <!--<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">-->
    <link href="//at.alicdn.com/t/font_620856_28hi1hpxx24.css" rel="stylesheet" type="text/css">
    <!-- ga & ba script hoook -->
    <script></script>

    









<meta name="generator" content="Hexo 7.1.1"></head>

<body>

<div class="site-nav-toggle" id="site-nav-toggle">
    <button>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
        <span class="btn-bar"></span>
    </button>
</div>

<div class="index-about">
    <i>  </i>
</div>

<div class="index-container">
    
    <div class="index-left">
        
<div class="nav" id="nav">
    <div class="avatar-name">
        <div class="avatar ">
            <img src="/admirefish/" />
        </div>
        <div class="name">
            <i>旅人</i>
        </div>
    </div>
    <div class="contents" id="nav-content">
        <ul>
            <li >
                <a href="/admirefish/">
                    <i class="iconfont icon-shouye1"></i>
                    <span>主页</span>
                </a>
            </li>
            <li >
                <a href="/admirefish/tags">
                    <i class="iconfont icon-biaoqian1"></i>
                    <span>标签</span>
                </a>
            </li>
            <li >
                <a href="/admirefish/archives">
                    <i class="iconfont icon-guidang2"></i>
                    <span>存档</span>
                </a>
            </li>
            <li >
                <a href="/admirefish/collect/">
                    <i class="iconfont icon-shoucang1"></i>
                    <span>收藏</span>
                </a>
            </li>
            <li >
                <a href="/admirefish/about/">
                    <i class="iconfont icon-guanyu2"></i>
                    <span>关于</span>
                </a>
            </li>
            
            <li>
                <a id="search">
                    <i class="iconfont icon-sousuo1"></i>
                    <span>搜索</span>
                </a>
            </li>
            
        </ul>
    </div>
    
        <div id="toc" class="toc-article">
    <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Swift5-9-2"><span class="toc-text">Swift5.9.2</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%B6%E4%BB%96%E7%AB%A0%E8%8A%82%E5%BF%AB%E9%80%9F%E5%AF%BC%E8%88%AA"><span class="toc-text">其他章节快速导航</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AE%80%E4%BB%8B"><span class="toc-text">简介</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A8%8B%E5%BA%8Fprint-%E2%80%9CHello-world-%E2%80%9D"><span class="toc-text">第一个程序print(“Hello world!”)</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E6%9C%80%E5%B0%8F%E5%B7%A5%E7%A8%8B"><span class="toc-text">获取最小工程</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BF%90%E8%A1%8Chello-world"><span class="toc-text">运行hello world!</span></a></li></ol></li></ol></li></ol>
</div>
    
</div>


<div class="search-field" id="search-field">
    <div class="search-bg" id="search-bg"></div>
    <div class="search-container">
        <div class="search-input">
            <span id="esc-search"> <i class="icon-fanhui iconfont"></i></span>
            <input id="search-input"/>
            <span id="begin-search">搜索</span>
        </div>
        <div class="search-result-container" id="search-result-container">

        </div>
    </div>
</div>

        <div class="index-about-mobile">
            <i>  </i>
        </div>
    </div>
    
    <div class="index-middle">
        <!-- Main Content -->
        


<div class="post-container">
    <div class="post-title">
        Swift5.9
    </div>

    <div class="post-meta">
        <span class="attr">发布于：<span>2024-02-07 15:23:46</span></span>
        
        <span class="attr">标签：/
        
        <a class="tag" href="/admirefish/tags/#Swift" title="Swift">Swift</a>
        <span>/</span>
        
        
        </span>
        <span class="attr">访问：<span id="busuanzi_value_page_pv"></span>
</span>
</span>
    </div>
    <div class="post-content no-indent">
        <h1 id="Swift5-9-2"><a href="#Swift5-9-2" class="headerlink" title="Swift5.9.2"></a>Swift5.9.2</h1><h2 id="其他章节快速导航"><a href="#其他章节快速导航" class="headerlink" title="其他章节快速导航"></a>其他章节快速导航</h2><h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p>  <a target="_blank" rel="noopener" href="https://docs.swift.org/swift-book/documentation/the-swift-programming-language/">Swift语言</a>用在Apple系app开发，或者其他已知未知的用途。<br>  在我实际使用过程中，发现Swift虽然不断的更新，但是已存在的项目使用的版本通常不是最新，可能是Swift4或者Swift5，于是如果使用一些最新的特性，就无法编译运行。</p>
<p>   这并不是一份纯粹面向新手的Swift教学，更像是我阅读Swift官网的文档时做的翻译和笔记。<br>   如果把这份文档当做自学材料的话，最起码希望读者对编程语言有所了解，知道变量、常量、数据类型、函数调用之类最基本的知识（纯小白的话可以结合 科学上网 + chatGPT，GPT是最好的60分老师，不接受反驳。），再来一起研究Swift.<br>   这里，我们将整个Swift的学习大致分为3部分。</p>
<ul>
<li>基础语法(包括：print(“hello world!”)、数据类型、循环语句、函数调用、参数传递等编程语言通用内容)</li>
<li>协议、拓展</li>
<li>设计模式与编码技巧</li>
<li>Swift新特性</li>
</ul>
<p>  如果你在学习过程中有遇到什么想要和我讨论的问题的话，可以通过邮箱将问题描述清楚发送给我。<br>  我会回复，Email: <a href="mailto:&#x32;&#x38;&#51;&#54;&#x37;&#x38;&#x39;&#x35;&#x39;&#64;&#x71;&#113;&#46;&#99;&#x6f;&#109;">&#x32;&#x38;&#51;&#54;&#x37;&#x38;&#x39;&#x35;&#x39;&#64;&#x71;&#113;&#46;&#99;&#x6f;&#109;</a></p>
<h2 id="第一个程序print-“Hello-world-”"><a href="#第一个程序print-“Hello-world-”" class="headerlink" title="第一个程序print(“Hello world!”)"></a>第一个程序print(“Hello world!”)</h2><p>  软件运行在一定环境之上，xcode提供了一个纯粹的Swift练习环境，叫做Playground。</p>
<h3 id="获取最小工程"><a href="#获取最小工程" class="headerlink" title="获取最小工程"></a>获取最小工程</h3><p>  ① git clone <a href="mailto:&#x67;&#x69;&#x74;&#64;&#x67;&#105;&#x74;&#x65;&#x65;&#x2e;&#99;&#111;&#x6d;">&#x67;&#x69;&#x74;&#64;&#x67;&#105;&#x74;&#x65;&#x65;&#x2e;&#99;&#111;&#x6d;</a>:fishAdmire&#x2F;swift5.9.git，获得一个最小工程<br>  ② 直接访问 <a target="_blank" rel="noopener" href="https://gitee.com/fishAdmire/swift5.9/tree/master">https://gitee.com/fishAdmire/swift5.9/tree/master</a> 下载这个工程<br>  <img src="/admirefish/2024/02/07/Swift5-9/01.png" alt="01"></p>
<h3 id="运行hello-world"><a href="#运行hello-world" class="headerlink" title="运行hello world!"></a>运行hello world!</h3><ul>
<li>双击swift5.9.xcodeproj，直接进入工程。</li>
<li>选中MyPlayground.playground文件，<strong>点击文件line5</strong>所在的执行标记，就可以看到成功打印出了hello world!<br>  <img src="/admirefish/2024/02/07/Swift5-9/02.png" alt="02"></li>
</ul>
<p>  有兴趣可以了解一下创建工程流程，和添加playground文件，不在此次范围内，不展开讨论。</p>

        
        <br />
        <div id="comment-container">
        </div>
        <div id="disqus_thread"></div>
        <div id="lv-container"></div>
        <div class="giscus"></div>
    </div>
</div>

    </div>
</div>


<footer class="footer">
    <ul class="list-inline text-center">
        
        

        

        

        

        

    </ul>
    
    <p>
        <span>/</span>
        
        <span><a target="_blank" rel="noopener" href="https://www.10000h.top">10000H</a></span>
        <span>/</span>
        
        <span><a href="xxxxx">xxxxx</a></span>
        <span>/</span>
        
        <span><a href="#">It helps SEO</a></span>
        <span>/</span>
        
        <span><a href="xxxxx">闽ICP备xxxxx号-1</a></span>
        <span>/</span>
        
    </p>
    
    <p>
        <span id="busuanzi_container_site_pv">
            <span id="busuanzi_value_site_pv"></span>PV
        </span>
        <span id="busuanzi_container_site_uv">
            <span id="busuanzi_value_site_uv"></span>UV
        </span>
        Created By <a target="_blank" rel="noopener" href="https://hexo.io/">Hexo</a>  Theme <a target="_blank" rel="noopener" href="https://github.com/aircloud/hexo-theme-aircloud">AirCloud</a></p>
</footer>




</body>

<script>
    // We expose some of the variables needed by the front end
    window.hexo_search_path = "search.json"
    window.hexo_root = "/admirefish/"
    window.isPost = true
</script>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

<script src="/admirefish/js/index.js"></script>

<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>






</html>
